<?php
include "../tambah/date.php";
include "../txt/url.php";
$per_page=8;
include_once('../Connections/sepolwan_connect.php');
if(isset($_POST['pageLimit']) && !empty($_POST['pageLimit'])){
    $pageLimit=$_POST['pageLimit'];
}else{
    $pageLimit='0';
}
$pageLimit=$pageLimit;



mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_tampil_member = "SELECT * FROM memberdb WHERE nama_user = '".$_GET['user']."'";
$tampil_member = mysql_query($query_tampil_member, $sepolwan_connect) or die(mysql_error());
$row_tampil_member = mysql_fetch_assoc($tampil_member);
$totalRows_tampil_member = mysql_num_rows($tampil_member);


mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_folowing = "SELECT * FROM ikut WHERE ke = '".$row_tampil_member['id']."' and dari <> '".$row_tampil_member['id']."' ORDER BY id DESC limit ".$pageLimit.",".$per_page;
$folowing = mysql_query($query_folowing, $sepolwan_connect) or die(mysql_error());
$row_folowing = mysql_fetch_assoc($folowing);
$totalRows_folowing = mysql_num_rows($folowing);


?>
<?php 

 if ($totalRows_folowing > 0) { // Show if recordset not empty ?>
  
  
  
  <table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
         <tr>
         <?php $kolom = 4;
		$i = 0; if  ($totalRows_folowing>0) { do { 
		if ($i >= $kolom) {
        echo "<tr></tr>";
        $i = 0;
    }
    $i++;
		?>
          <?php
	
$angka = $d++; //mengambil isi dari textbox dan memasukkan ke variabel angka
if (($angka % 4) == 0) { //jika angka di bagi 2 hasilnya 0
echo ""; //cetak angka dan angka adalah bilangan genap
} else
echo "<td width='10'>&nbsp;</td>"; //cetak angka dan angka adalah bilangan ganjil

mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_tl_user = "SELECT * FROM memberdb WHERE aktif = 'ya' AND id = '".$row_folowing['dari']."' ";
$tl_user = mysql_query($query_tl_user, $sepolwan_connect) or die(mysql_error());
$row_tl_user = mysql_fetch_assoc($tl_user);
$totalRows_tl_user = mysql_num_rows($tl_user);
?>
           <td width="230" align="center" valign="top">
  <div style="width:230px; height:230px; overflow:hidden; border:1px solid #CCC"><a href="../<?php echo $row_tl_user['nama_user'] ?>" target="_parent"><img src="<?php if($row_tl_user['foto_profile']<>NULL){ if (file_exists("../images/member/ava/resize_230_230_".$row_tl_user['foto_profile'])) { echo $base."images/member/ava/resize_230_230_".md5($row_tl_user['id']).".jpg"; } else {  if (file_exists("../images/member/ava/".$row_tl_user['foto_profile'])) { echo $base."images/member/ava/tester_230_230_".md5($row_tl_user['id']).".jpg"; } else { echo $base."images/member/ava/resize_230_230_default.jpg"; } } } else { echo $base."images/member/ava/resize_230_230_default.jpg"; }  ?>" style="min-height:230px;" /></a> </div>
<div style="width:200px; background:#FFF; padding:15px; border:1px solid #CCC"><strong><?php if (strlen($row_tl_user['full_name'])>17) { echo substr($row_tl_user['full_name'],0,17)." ..."; } else { echo $row_tl_user['full_name']; } ?></strong><br />

  ( <a href="../<?php echo $row_tl_user['nama_user'] ?>"><?php if (strlen($row_tl_user['nama_user'])>17) { echo substr($row_tl_user['nama_user'],0,17)." ..."; } else { echo $row_tl_user['nama_user']; } ?></a> )
 </div><br /></td>
	
	<?php
	
mysql_free_result($tl_user);
	 } while ($row_folowing = mysql_fetch_array($folowing)); } ?>
         </tr>
       </table>
  
  
  
  <?php
$loadCount=$pageLimit+$per_page;
 if($totalRows_folowing >= $per_page){ ?>
       <div class="load_more_link">
       <input type="button" class="button" value="Load More" 
       onclick=loadData(<?php echo $loadCount ?>)>
       <span class="flash"></span></div> <?php
 }
}else{
       echo 'No Data Found';
}
  
?>